Storage: Eliminating listing storage account when its resource ID is available to use GET #28617
+41
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Community Note
Description
Listing storage accounts under the scope of a subscription causing a lot of data consistency issues as is reported in #15048. Almost, all the list calls come from the invocation of
terraform-provider-azurerm/internal/services/storage/client/helpers.go
Line 149 in 509724a
The main reason to call the list is to map a storage account name to a storage account ID, with its API model (contains the different storage service endpoints).
There are multiple call points, which can be catagorized into the following:
azurerm_machine_learning_datastore_blobstorage
): This is mostly because the API is designed to contain only the storage account name and a container name, while the provider tends to combine them into a storage container id (for UX).In the other case, that are covered by this PR is that the resource itself has the full storage account ID (instead of the name):
azurerm_storage_account
,azurerm_storage_account_static_website
,azurerm_storage_account_queue_properties
: The resource id is just the storage account resource idazurerm_storage_containers
DS: It references the storage account idFor these cases, a simple storage account targeted
GET
is enough.For the long run, I think the storage account detail is not necessary for those data plane resources to build their clients. Since those data plane resources have their service-specific endpoint as the their resource id, we can then statically build the endpoints for other services, with a little more care about the Azure DNS zone endpoints. I'll hold on implementing this part until we've reached an agreement on this direction.
PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_resource
- support for thething1
property [GH-00000]This is a (please select all that apply):
Related Issue(s)
Relating to #15048
Note
If this PR changes meaningfully during the course of review please update the title and description as required.